import axios from 'axios'
import { App } from 'vue'
import VueAxios from 'vue-axios'


const ax = axios.create({
    baseURL: process.env.VUE_APP_API_ADDRESS,
    timeout: 5000,
    headers: { 'Access-Control-Allow-Origin': '*' },
})


export default {
    install: (app: App): void => {
        //vue2 中挂载 $http,$axios
        app.use(VueAxios, ax)
        //vue  3  全局提供axios实例,需要的地方可以注入
        app.provide('axios', ax)
    }
}
